package o;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.huawei.appgallery.agwebview.api.ui.IWebViewActivityProtocol;

public class fal {
    private static fal ॱ;

    public static synchronized fal ˊ() {
        fal o_fal;
        synchronized (fal.class) {
            if (ॱ == null) {
                ॱ = new fal();
            }
            o_fal = ॱ;
        }
        return o_fal;
    }

    public void ˊ(@NonNull Context context, @NonNull String str) {
        ˊ(context, str, null);
    }

    public void ˊ(@NonNull Context context, @NonNull String str, Bundle bundle) {
        boolean z = false;
        if (context == null) {
            throw new IllegalArgumentException("the Context is null");
        } else if (!dof.ॱ(str)) {
            String ˎ = ˎ(str);
            azl o_azl = (azl) fho.ˏ().ˋ("AGWebView").ॱ(azl.class);
            boolean z2 = o_azl != null && o_azl.ˊ(context, ˎ);
            try {
                if ("1".equals(Uri.parse(ˎ).getQueryParameter("fullScreen")) || z2) {
                    z = true;
                }
            } catch (Exception e) {
                Logger.e("BuoyWebViewLauncher", "parse the query param from url exception");
            }
            if (z) {
                fjb ˎ2 = fho.ˏ().ˋ("AGWebView").ˎ("webview_activity");
                IWebViewActivityProtocol iWebViewActivityProtocol = (IWebViewActivityProtocol) ˎ2.ˊ();
                if (z2) {
                    iWebViewActivityProtocol.setUri("internal_webview");
                } else {
                    iWebViewActivityProtocol.setUri("buoy_webview");
                }
                iWebViewActivityProtocol.setUrl(ˎ);
                fam.ॱ().ॱ(context, cjl.ˋ("webview_activity"), ˎ2, true);
                return;
            }
            if (bundle == null) {
                bundle = new Bundle();
            }
            bundle.putString("url", ˎ);
            fam.ॱ().ˏ(context, new bho(context), bundle);
        }
    }

    private String ˎ(String str) {
        if (dof.ˋ(str) || str.indexOf("://") != -1) {
            return str;
        }
        return "https://" + str;
    }
}
